<template>
	<slot :controller="controller" :store="store" :model="model">
		<AppForm
			ref="editForm"
			v-bind="$attrs"
			:id="controlID"
			:name="model.codeName"
			:class="classNames"
			:data="store.data"
		>
			<AppAnchor
				v-if="store.anchorData.length > 0"
				:controlID="controlID"
				:anchorData="store.anchorData"
			/>
			<div class="control-content app-control-form__content">
				<AppRow :layoutOpts="{ selfLayout: 'TABLE_24COL' }">
					<AppCol
						noRoot
						:visible="store.detailModel.group1.visible"
						:layoutOpts="{
							selfLayout: 'TABLE_24COL',
							parentLayout: 'TABLE_24COL',
							colMD: 24,
						}"
					>
						<template #default="{ slotClass, slotStyle }">
							<slot
								name="group1"
								:controller="controller"
								:store="store"
								:model="model"
								:slotClass="slotClass"
								:slotStyle="slotStyle"
								:actions="{ handleComponentAction }"
							>
								<AppFormGroup
									name="group1"
									v-show="store.detailModel.group1.visible"
									:slotClass="slotClass"
									:slotStyle="slotStyle"
									:layoutOpts="{
										selfLayout: 'TABLE_24COL',
										parentLayout: 'TABLE_24COL',
										colMD: 24,
									}"
									title="系统角色基本信息"
									subCaption=""
									:enableAnchor="false"
									:showMoreItems="store.detailModel.group1.showMoreItems"
									:showMoreMode="store.detailModel.group1.showMoreMode"
									:infoGroupMode="true"
									:titleBarCloseMode="0"
									:showCaption="true"
									:uIActionGroup="store.detailModel.group1.uIActionGroup"
									@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
								>
									<AppCol
										noRoot
										:visible="store.detailModel.id.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 8,
											colMD: 8,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="id"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="id"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="标识"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.id.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="idEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="25"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																editorType="SPAN"
																style=""
																name="id"
																noValueShowMode="STYLE1"
																:value="store.data.id"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.name.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 8,
											colMD: 8,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="name"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="name"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="名称"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.name.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="nameEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="25"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																editorType="SPAN"
																style=""
																name="name"
																noValueShowMode="STYLE1"
																:value="store.data.name"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.authority.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 8,
											colMD: 8,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="authority"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="authority"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="角色代码标记"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.authority.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="authorityEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="25"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																editorType="SPAN"
																style=""
																name="authority"
																noValueShowMode="STYLE1"
																:value="store.data.authority"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.workflow_group.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 8,
											colMD: 8,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="workflow_group"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="workflow_group"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="是否是工作流用户组"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.workflow_group.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="workflow_groupEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSwitch
																v-bind="{ editorType: 'SWITCH' }"
																style=""
																name="workflow_group"
																:disabled="
																	store.detailModel.workflow_group.disabled
																"
																:value="store.data.workflow_group"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.group_scope.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 8,
											colMD: 8,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="group_scope"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="group_scope"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="范围"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.group_scope.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="group_scopeEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="25"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																editorType="SPAN"
																style=""
																name="group_scope"
																noValueShowMode="STYLE1"
																:value="store.data.group_scope"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.description.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 24,
											colMD: 24,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="description"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="description"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="描述"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.description.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="descriptionEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="25"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																editorType="SPAN"
																style=""
																name="description"
																noValueShowMode="STYLE1"
																:value="store.data.description"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
								</AppFormGroup>
							</slot>
						</template>
					</AppCol>
					<AppCol
						noRoot
						:visible="store.detailModel.grouppanel1.visible"
						:layoutOpts="{
							selfLayout: 'TABLE_24COL',
							parentLayout: 'TABLE_24COL',
							colMD: 24,
						}"
					>
						<template #default="{ slotClass, slotStyle }">
							<slot
								name="grouppanel1"
								:controller="controller"
								:store="store"
								:model="model"
								:slotClass="slotClass"
								:slotStyle="slotStyle"
								:actions="{ handleComponentAction }"
							>
								<AppFormGroup
									name="grouppanel1"
									v-show="store.detailModel.grouppanel1.visible"
									:slotClass="slotClass"
									:slotStyle="slotStyle"
									:layoutOpts="{
										selfLayout: 'TABLE_24COL',
										parentLayout: 'TABLE_24COL',
										colMD: 24,
									}"
									title=""
									:enableAnchor="false"
									:showMoreItems="store.detailModel.grouppanel1.showMoreItems"
									:showMoreMode="store.detailModel.grouppanel1.showMoreMode"
									:infoGroupMode="true"
									:titleBarCloseMode="0"
									:showCaption="false"
									:uIActionGroup="store.detailModel.grouppanel1.uIActionGroup"
									@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
								>
									<AppCol
										noRoot
										:visible="store.detailModel.grouppanel2.visible"
										:layoutOpts="{
											selfLayout: 'TABLE_24COL',
											parentLayout: 'TABLE_24COL',
											colLG: 10,
											colMD: 10,
										}"
									>
										<template #default="{ slotClass, slotStyle }">
											<slot
												name="grouppanel2"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormGroup
													name="grouppanel2"
													v-show="store.detailModel.grouppanel2.visible"
													:slotClass="slotClass"
													:slotStyle="slotStyle"
													:layoutOpts="{
														selfLayout: 'TABLE_24COL',
														parentLayout: 'TABLE_24COL',
														colLG: 10,
														colMD: 10,
													}"
													title="资源"
													subCaption=""
													:enableAnchor="false"
													:showMoreItems="
														store.detailModel.grouppanel2.showMoreItems
													"
													:showMoreMode="
														store.detailModel.grouppanel2.showMoreMode
													"
													:infoGroupMode="true"
													:titleBarCloseMode="0"
													:showCaption="true"
													:uIActionGroup="
														store.detailModel.grouppanel2.uIActionGroup
													"
													@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
												>
													<AppCol
														noRoot
														:visible="
															store.detailModel.granted_authorities.visible
														"
														:layoutOpts="{
															parentLayout: 'TABLE_24COL',
															colMD: 24,
														}"
													>
														<template v-slot:default="{ slotStyle, slotClass }">
															<slot
																name="granted_authorities"
																:controller="controller"
																:store="store"
																:model="model"
																:slotClass="slotClass"
																:slotStyle="slotStyle"
																:actions="{ handleComponentAction }"
															>
																<AppFormItem
																	name="granted_authorities"
																	:slotStyle="slotStyle"
																	:slotClass="slotClass"
																	label=""
																	labelPos="LEFT"
																	:labelWidth="0"
																	:showLabel="true"
																	:enableAnchor="false"
																	:rules="
																		store.detailModel.granted_authorities
																			.valueRule
																	"
																	:emptyCaption="true"
																>
																	<div class="form-editor-container">
																		<slot
																			name="granted_authoritiesEditor"
																			:controller="controller"
																			:store="store"
																			:model="model"
																			:actions="{ handleComponentAction }"
																		>
																			<Granted_authorities_tree
																				v-bind="{
																					editorType: 'MDROPDOWNLIST',
																					editorStyle:
																						'granted_authorities_tree',
																					url: '/sys_deploy_systems/{deploy_system_id}/getpermissions',
																					requestMode: 'post',
																				}"
																				:controller="controller"
																				:store="store"
																				name="granted_authorities"
																				:disabled="
																					store.detailModel.granted_authorities
																						.disabled
																				"
																				:value="store.data.granted_authorities"
																				@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
																			/>
																		</slot>
																	</div>
																</AppFormItem>
															</slot>
														</template>
													</AppCol>
												</AppFormGroup>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.rawitem1.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 1,
											colMD: 1,
										}"
									>
										<slot
											name="rawitem1"
											:controller="controller"
											:store="store"
											:model="model"
										>
											<AppFormRaw
												name="rawitem1"
												:context="store.context"
												:viewParams="store.viewParams"
												:data="store.data"
												contentType="PLACEHOLDER"
												sizeStyle="height:-1px;width:-1px"
											/>
										</slot>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.grouppanel3.visible"
										:layoutOpts="{
											selfLayout: 'TABLE_24COL',
											parentLayout: 'TABLE_24COL',
											colLG: 13,
											colMD: 13,
										}"
									>
										<template #default="{ slotClass, slotStyle }">
											<slot
												name="grouppanel3"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormGroup
													name="grouppanel3"
													v-show="store.detailModel.grouppanel3.visible"
													:slotClass="slotClass"
													:slotStyle="slotStyle"
													:layoutOpts="{
														selfLayout: 'TABLE_24COL',
														parentLayout: 'TABLE_24COL',
														colLG: 13,
														colMD: 13,
													}"
													title="成员"
													subCaption=""
													:enableAnchor="false"
													:showMoreItems="
														store.detailModel.grouppanel3.showMoreItems
													"
													:showMoreMode="
														store.detailModel.grouppanel3.showMoreMode
													"
													:infoGroupMode="true"
													:titleBarCloseMode="0"
													:showCaption="true"
													:uIActionGroup="
														store.detailModel.grouppanel3.uIActionGroup
													"
													@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
												>
													<AppCol
														noRoot
														:visible="store.detailModel.druipart1.visible"
														:layoutOpts="{
															parentLayout: 'TABLE_24COL',
															colMD: 24,
														}"
													>
														<slot
															name="druipart1"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppFormDruipart
																name="druipart1"
																:paramItem="model.entityCodeName.toLowerCase()"
																:parentName="model.entityCodeName"
																:context="store.context"
																:viewParams="store.viewParams"
																:data="store.data"
																:isLoaded="store.isLoaded"
																:tempMode="0"
																viewName="sys_role_memberUsr0310377617GridView"
																@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
															>
															</AppFormDruipart>
														</slot>
													</AppCol>
												</AppFormGroup>
											</slot>
										</template>
									</AppCol>
								</AppFormGroup>
							</slot>
						</template>
					</AppCol>
				</AppRow>
			</div>
		</AppForm>
	</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{spinalCase ctrl.codeName}}-form-base.vue.hbs生成
import Granted_authorities_tree from '@plugins/editor/granted-authorities-tree/granted-authorities-tree.vue';

import { Ref } from 'vue';
import { AppAnchor } from '@components/common/anchor';
import { AppCol } from '@/components/common/col';
import { AppRow } from '@/components/common/row';
import {
	AppForm,
	AppFormPage,
	AppFormGroup,
	AppFormTabPage,
	AppFormItem,
	AppFormButton,
	AppFormDruipart,
	AppFormIframe,
	AppFormRaw,
	AppFormMdCtrl,
	AppFormMdCtrlRepeater,
} from '@components/widgets/form';
import {
	IEvent,
	EditFormActionType,
	IEditFormAbility,
	IEditFormStore,
	IParam,
} from '@/core';
import {
	useProps,
	useBasic,
	useAction,
	useController,
} from './usr-0309527282-form-hook';

const editForm: Ref = ref(null);

// 输入参数
const props = defineProps(useProps());

// 基础数据
const {
	controlID,
	getClassNames,
	model,
	useNavParamsBind,
	useEventBind,
	handleActionClick,
	handleComponentAction,
} = useBasic(props);

const emit = defineEmits<{
	(
		event: 'ctrl-action',
		name: string,
		action: EditFormActionType,
		data: IParam[]
	): void;
	(event: 'ctrl-init', name: string, data: IEditFormAbility): void;
	(event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
	return getClassNames(props);
});

//  表单控制器
const controller = useController(props, evt, { controlID, editForm });

useNavParamsBind(controller, props);

const store: IEditFormStore = controller.getStore();

const ctrlService = controller.getCtrlService();

onMounted(() => {
	controller.ctrlMounted();
});
onUnmounted(() => {
	controller.ctrlDestroy();
});
</script>
